<?php

namespace app\common\validate;

use think\Validate;

class Wpdocument extends Validate
{
    protected $rule = [
        'title' => 'require|length:2,100',
        'content' => 'require',
        'images' => 'array',
        'status' => 'require|in:normal,hidden',
        'user_id' => 'require|number'
    ];
    
    protected $message = [
        'title.require' => '标题不能为空',
        'title.length' => '标题长度必须在2-100个字符之间',
        'content.require' => '内容不能为空',
        'images.array' => '图片必须是数组格式',
        'status.require' => '状态不能为空',
        'status.in' => '状态值不正确',
        'user_id.require' => '创建者不能为空',
        'user_id.number' => '创建者ID必须是数字'
    ];
    
    protected $scene = [
        'add' => ['title', 'content', 'images', 'status', 'user_id'],
        'edit' => ['title', 'content', 'images',  'status']
    ];
}